
	DECLARE		@AreaNO	VARCHAR(50)
	DECLARE		@ONO		VARCHAR(50)
	DECLARE		@CNO		VARCHAR(50)
	
	set @AreaNO='0130'
	set @ONO='2'
	set @CNO='885'
	
--SELECT a.ONO,a.CNO,a.ChannelNO,c.ChannelOrder,c.ChannelNumber,a.SendCount,a.NextTime 
--FROM T_Rules a,T_Area b,T_Channel c WITH(NOLOCK) 
--WHERE a.ProvinceID=b.ProvinceID AND a.ONO=b.ONO AND a.ChannelNO=c.ChannelNO 
-- AND a.Status='1' 
-- AND b.AreaNO=@AreaNO AND a.ONO=@ONO AND a.CNO=@CNO AND a.NextTime=CONVERT(VARCHAR(10),GETDATE(),120)

SELECT a.ONO,a.CNO,a.ChannelNO,c.ChannelOrder,c.ChannelNumber,a.SendCount,a.NextTime 
FROM T_Rules a,T_Area b,T_Channel c  WITH(NOLOCK) 
WHERE a.ProvinceID=b.ProvinceID AND a.ONO=b.ONO AND a.ChannelNO=c.ChannelNO 
AND B.AreaNO NOT IN (SELECT d.AreaNO FROM T_MaskArea d WITH(NOLOCK) WHERE a.ProvinceID=d.ProvinceID AND A.ChannelNO=d.ChannelNO AND A.ONO=d.ONO) 
AND a.Status='1' 
AND b.AreaNO=@AreaNO AND a.ONO=@ONO AND a.CNO=@CNO AND a.NextTime=CONVERT(VARCHAR(10),GETDATE(),120)
